<%@LANGUAGE="JSCRIPT"%>
<!-- #include virtual="/WebCATI/includes/IO.asp" -->
<%
    var usr = String(Request("USR"));
    var idx = parseFloat(Request("IDX"));

    idx++;

    if(IsDataAvailable(usr, idx))
    {
        if(IsHtml(usr, idx))
        {
            if(LatestHtmlIndex(usr) == idx)
            {
                Response.Write("document.location.href = \"/WebCATI/admin/monitor.asp?USR=" + usr + "&IDX=" + idx + "\";");
            }
            else
            {
                Response.Write("document.location.href = \"/WebCATI/admin/monitor.asp?USR=" + usr + "&IDX=0\";");
            }
        }
        else
        {
            ReplayEvents(usr, idx);
        }
    }
%>